﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Client.Service;
using ModelLayer;

namespace Client
{
    public partial class ConfirmReservation : Form
    {
        private Customer cust;
        private Show show;
        private ICustomer custService;
        private IShow showService;

        public ConfirmReservation()
        {
            InitializeComponent();
            showService = new ShowClient("BasicHttpBinding_IShow");
            custService = new CustomerClient("BasicHttpBinding_ICustomer");
        }

        private void ConfirmReservation_Load(object sender, EventArgs e)
        {
            DisplayCustomerName();
            DisplayCustomerAddress();
            DisplayCustomerCity();
            DisplayCustomerPhoneNo();
            DisplayCustomerEmail();

            DisplayShowName();
            DisplayScreenName();
            DisplayShowDate();
            DisplayShowTime();
            DisplayNoOfSeatsBooked();

        }

        #region Confirm reservation Methods
        private void DisplayCustomerName()
        {
            Customer cust = custService.GetCustomerByPhoneNo("11223344");
            custNameLabel.Text = cust.FName + " " + cust.LName;
        }

        private void DisplayCustomerAddress()
        {
            Customer cust = custService.GetCustomerByPhoneNo("11223344");
            custAddressLabel.Text = cust.Address;
        }

        private void DisplayCustomerCity()
        {
            Customer cust = custService.GetCustomerByPhoneNo("11223344");
            custPostalCodeLabel.Text = cust.PostalCode.ToString();
            custCityNameLabel.Text = cust.City;
        }

        private void DisplayCustomerPhoneNo()
        {
            Customer cust = custService.GetCustomerByPhoneNo("11223344");
            custPhoneNoLabel.Text = cust.PhoneNo.ToString();
        }

        private void DisplayCustomerEmail()
        {
            Customer cust = custService.GetCustomerByPhoneNo("11223344");
            custEmailLabel.Text = cust.Email.ToString();
        }


        private void DisplayShowName()
        {
            Show show = showService.GetShow(1);
            chosenShowNameLabel.Text = show.Type.Title;
        }

        //TODO: Viser DateTime, den bør kun vise dato
        private void DisplayShowDate()
        {
            Show show = showService.GetShow(1);
            chosenShowDateLabel.Text = show.Date.ToString();
        }

        //TODO: Viser DateTime, den bør kun vise tid
        private void DisplayShowTime()
        {
            Show show = showService.GetShow(1);
            chosenShowTimeLabel.Text = show.Date.ToString();
        }

        private void DisplayScreenName()
        {
            Show show = showService.GetShow(1);
            chosenShowRoomLabel.Text = show.Room.RoomNumber.ToString();
        }

        private void DisplayNoOfSeatsBooked()
        {
            //TODO: Find en løsning
            chosenNumberOfSeatsLabel.Text = "Metoden er fucked op";
        }
        #endregion

        private void BookButton_Click(object sender, EventArgs e)
        {
            //TODO: Lav en reserver metode.
        }

        private void BuyButton_Click(object sender, EventArgs e)
        {
            //TODO: Lav en køb metode
        }
    }
}
